#include <iostream>
using namespace std;

class Point
{
	friend class Rectangle;
public:
	Point(int x = 0, int y = 0)
		:_x(x)
		,_y(y)
	{}
private:
	int _x;
	int _y;
};

class Rectangle
{
public:
	Rectangle(Point topLeft = {0, 0},Point topRight = {0, 0},
		Point bottomLeft = {0, 0},Point bottomRight = {0, 0})
		:_topLeft(topLeft)
		,_topRight(topRight)
		,_bottomLeft(bottomLeft)
		,_bottomRight(bottomRight)
	{}

	int getArea() const; // 如果是长方形则返回长方形的面积，否则返回0
	bool isIn(Point p) const; // 如果是长方形则判断传入的点是否在该图形之内（不包括边界），
	// 如果在内部返回true，不在内部则返回false。如果不是长方形，则一律返回false。

private:
	bool isRectangle() const;
	// 判断4个顶点构成的图形是不是长方形，是则返回true，否则返回false。
	// 这个方法只在本类中调用，所以可声明为private的。

	Point _topLeft;
	Point _topRight;
	Point _bottomLeft;
	Point _bottomRight;
};

bool Rectangle::isRectangle() const
{
	if (_topLeft._y != _topRight._y) return false;
	if (_bottomLeft._y != _bottomRight._y) return false;

	if (_topLeft._x != _bottomLeft._x) return false;
	if (_topRight._x != _bottomRight._x) return false;

	if (_topLeft._x >= _topRight._x) return false;
	if (_topLeft._y >= _bottomLeft._y) return false;

	return true;
}

int Rectangle::getArea() const
{
	if (isRectangle() == false) return 0;
	return (_bottomRight._x - _topLeft._x) 
		 * (_bottomRight._y - _topLeft._y);
}

bool Rectangle::isIn(Point p) const
{
	if (isRectangle() == false) return 0;
	return (_topLeft._x < p._x && _bottomRight._x > p._x)
		&& (_topLeft._y < p._y && _bottomRight._y > p._y);
}

// 说明：由于在Rectangle类中有大量的语句需要使用到Point类的私有成员x和y，
// 因此，使用友元可直接访问x和y，从而可减少编程中的麻烦。

// 使用main函数测试以上getArea方法和isIn方法。main函数可参考如下代码：
int main()
{
	int topLeftX, topLeftY, topRightX, topRightY, 
		bottomLeftX, bottomLeftY, bottomRightX, bottomRightY;
	int px, py;

	cin >> topLeftX >> topLeftY >> topRightX >> topRightY 
		>> bottomLeftX >> bottomLeftY >> bottomRightX >> bottomRightY;
	cin >> px >> py;

	Point p(px, py);
	Rectangle r(Point(topLeftX, topLeftY), Point(topRightX, topRightY)
			  , Point(bottomLeftX, bottomLeftY), Point(bottomRightX, bottomRightY));
	cout << r.getArea() << endl;
	if (r.isIn(p))
		cout << "In" << endl;
	else
		cout << "Not in" << endl;

	return 0;
}
